package com.yjh.admin.config;


import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.yjh.admin.mapper")
public class MybatisPlusConfig {

    /**

     * 分页插件

     */

    @Bean

    public PaginationInterceptor paginationInterceptor() {

        return new PaginationInterceptor();

    }

    /**
     * 逻辑删除插件
     * @return
     */
    @Bean
    @ConditionalOnMissingBean
    public ISqlInjector sqlInjector() {
        return new LogicSqlInjector();
    }

//    /**
//
//     * 打印 sql
//
//     */
//
//    @Bean
//
//    public PerformanceInterceptor performanceInterceptor() {
//
//        PerformanceInterceptor performanceInterceptor =new PerformanceInterceptor();
//
//        //格式化sql语句
//
//        Properties properties =new Properties();
//
//        properties.setProperty("format", "faalse");
//
//        performanceInterceptor.setProperties(properties);
//
//        return performanceInterceptor;
//
//    }

}